<template>
  <div class="app-container">
    <!--工具栏-->
    <div class="head-container">
      <div v-if="crud.props.searchToggle">
        <el-input
          v-model="query.processId"
          clearable
          size="small"
          style="width: 200px"
          placeholder="流程ID"
          class="filter-item"
          @keyup.enter.native="crud.toQuery"
        />
        <el-date-picker
          v-model="query.updateTime"
          :default-time="['00:00:00','23:59:59']"
          type="daterange"
          range-separator=":"
          size="small"
          class="date-item"
          value-format="yyyy-MM-dd HH:mm:ss"
          start-placeholder="创建日期起"
          end-placeholder="创建日期止"
        />
        <rr-operation :crud="crud" />
      </div>
      <!-- <eHeader :dict="dict" :permission="permission" /> -->
      <crudOperation :permission="permission" />
    </div>
    <!--表格渲染-->
    <el-table ref="table" v-loading="crud.loading" :data="crud.data" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
      <el-table-column type="selection" width="55" />
      <el-table-column v-if="columns.visible('processId')" prop="processId" label="流程ID" />
      <!-- <el-table-column v-if="columns.visible('processName')" prop="processName" label="流程名称">
        <template slot-scope="scope">
          <div>{{ scope.row.processSuperiorName ? scope.row.processSuperiorName + ' / ' : '' }}{{ scope.row.process.name }}</div>
        </template>
      </el-table-column> -->
      <el-table-column v-if="columns.visible('submitSucceed')" prop="submitSucceed" label="上报成功" />
      <el-table-column v-if="columns.visible('notSubmit')" prop="notSubmit" label="未上报" />
      <el-table-column v-if="columns.visible('submitFailed')" prop="submitFailed" label="上报失败" />
      <el-table-column v-if="columns.visible('manualSucceed')" prop="manualSucceed" label="手动置成功" />
      <el-table-column v-if="columns.visible('submitted')" prop="submitted" label="已上报" />
      <el-table-column v-if="columns.visible('sysSucceed')" prop="sysSucceed" label="系统置成功" />
      <el-table-column v-if="columns.visible('updateTime')" prop="updateTime" label="创建日期">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.updateTime) }}</span>
        </template>
      </el-table-column>
    </el-table>
    <!--分页组件-->
    <pagination />
    <!--表单渲染-->
  </div>
</template>

<script>
import crudSummary from '@/api/postRecord/summary'
import CRUD, { presenter, header } from '@crud/crud'
import crudOperation from '@crud/CRUD.operation'
import pagination from '@crud/Pagination'
import rrOperation from '@crud/RR.operation'

// crud交由presenter持有
const defaultCrud = CRUD({
  title: '汇总',
  url: 'api/summary',
  crudMethod: { ...crudSummary }
})

export default {
  name: 'Summary',
  components: { pagination, crudOperation, rrOperation },
  mixins: [presenter(defaultCrud), header()],
  data() {
    return {
      permission: {
        add: ['summary:add'],
        edit: ['summary:edit'],
        del: ['summary:del'],
        download: ['summary:download']
      }
    }
  },
  methods: {
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
  /deep/ .el-input-number .el-input__inner {
    text-align: left;
  }
</style>
